package com.google.code.netz.wfe.model;

import java.util.List;

import com.google.code.netz.wfe.api.IWorkflowContext;

/**
 * Task associated with a Transition.
 * <p>
 * External actors can plug into a workflow instance by specifying a
 * {@link ITask} implentation.
 * <p>
 * We can lend our workflow engine implmentation a Transactional aspect by
 * having {@link ITask} extensions persist the state for a respective entity;
 * This is becase we model Tasks as the atomic units that pretty much drive our
 * workflow.
 * <p>
 * By leaving the Tasks to enforce or not enforce Transactionality,the workflow
 * implementation remains flexible. For non-transactional workflows the upside
 * might be better performance at the cost of robustness.
 * 
 * @author <a href='mailto:rahul.thakur.xdev@gmail.com'>Rahul Thakur</a>
 * @since 1.0
 * @version $Id: ITask.java 18 2009-02-09 15:38:23Z rahul.thakur.xdev@gmail.com
 *          $
 */
public interface ITask {

	/**
	 * Executes this ITask and returns a result.
	 * 
	 * @param workflowContext
	 */
	public void /* TODO: Return a result */execute(IWorkflowContext workflowContext);

	/**
	 * Adds an {@link IResult} declaration to this {@link ITask} instance.
	 * 
	 * @param result
	 */
	public void addResult(IResult result);

	/**
	 * Returns a list of declared {@link IResult}s for this {@link ITask}.
	 * 
	 * @return
	 */
	public List<IResult> getDeclaredResults();

}